#include<bits/stdc++.h>
using namespace std;
const int N = 2010;
int a[N];
int p[N];
int main(){
    freopen("permutation.in","r",stdin);
    freopen("permutation.out","w",stdout);
    int n,m;
    cin>>n>>m;
    for(int i = 1;i<=n*2;i++){
        a[i] = i;
    }
    int ans = 0;
    do{
        for(int i = 1;i<=2*n;i++){
            p[a[i]] = i;
        }
        bool f = 1;
        for(int i = 1;i<=n;i++){
            if(abs(p[i] - p[i + n])%m == 0){
                f = 0;
                break;
            }
        }
        ans += f;
    }while(next_permutation(a + 1,a + 1 + n*2));
    cout<<ans<<'\n';
}